package com.oepm.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oepm.biz.StuDemoFormBiz;
import com.oepm.dao.entity.QueryInfo;
import com.oepm.dao.entity.StuDemoFormPo;
import com.oepm.dao.mapper.StuDemoFormMapper;
import com.oepm.vo.DataVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StuDemoFormBizImpl implements StuDemoFormBiz {

    @Resource
    private StuDemoFormMapper stuDemoFormMapper;



    //插入学生申请表
    public int addStuDemoForm(StuDemoFormPo stuDemoFormPo){
        return stuDemoFormMapper.addStuDemoForm(stuDemoFormPo);
    }

    @Override
    public int updateStuDemoForm(StuDemoFormPo stuDemoFormPo) {
        return stuDemoFormMapper.updateStuDemoForm(stuDemoFormPo);
    }

    @Override
    public DataVo queryStuDemoForms(String stuid, QueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<StuDemoFormPo> stuDemoFormPos = stuDemoFormMapper.queryStuDemoForms(stuid);
        PageInfo<StuDemoFormPo> pi = new PageInfo<>(stuDemoFormPos);
        return new DataVo(pi.getTotal(),pi.getList());
    }

    @Override
    public int deleteStuDemoForm(String id) {
        return stuDemoFormMapper.deleteStuDemoForm(id);
    }

    @Override
    public String querystuidByid(String id) {
        return stuDemoFormMapper.querystuidByid(id);
    }

    @Override
    public List<StuDemoFormPo> queryStuDemoForms(String stuid) {
        return stuDemoFormMapper.queryStuDemoForms(stuid);
    }
}
